/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sistemperpustakaan.tablemodel;

import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;
import sistemperpustakaan.entity.ViewTransaksi;

/**
 *
 * @author EKo
 */
public class TransaksiTableModel extends AbstractTableModel {
List<ViewTransaksi> listTransaksi;
    String[] header = {"Transaksi ID","Anggota ID","NIS/NIK","Nama","Type Anggota"," No Detail","ID Inventaris","Judul Buku","Tangal Pinjam","Tanggal Kembali","Status","User","Terlambat","Denda"};

    public TransaksiTableModel() {
        listTransaksi = new ArrayList<ViewTransaksi>();
    }

    public TransaksiTableModel(List<ViewTransaksi> listpTransaksi) {
        this.listTransaksi = listpTransaksi;
    }

    public void setlistTransaksi(List<ViewTransaksi> listTransaksi) {
        this.listTransaksi = listTransaksi;
    }

    public int getRowCount() {
        return listTransaksi.size();
    }

    public int getColumnCount() {
        return 14;
    }

    public Object getValueAt(int rowIndex, int columnIndex) {
        return listTransaksi.get(rowIndex).getObject(columnIndex);
    }

    @Override
    public String getColumnName(int column) {
        return header[column];
    }

}
